try{
	loadAlbumView(); 
	function loadAlbumView()
	{
		var statusDataRemote;
		 statusDataRemote = Components.
							  classes["@songbirdnest.com/Songbird/DataRemote;1"].
							  createInstance(Components.interfaces.sbIDataRemote);
		statusDataRemote.init("faceplate.status.text", null);
		//End Remove
		mquery.resetQuery();
		mquery.addQuery("SELECT artist,genre, DISTINCT album FROM library ORDER BY artist");
		mquery.execute();
		mquery.waitForCompletion();
		var albums = mquery.getResultObject();
		var count = albums.getRowCount();
		var albumBoxArray=new Array();
		var viewBox = document.getElementById("albubox");
		var index
		for( var i = 0; i<count; i++)
		{
			albumBoxArray[i]=new AlbumBox();
			albumBoxArray[i].setArtist(albums.getRowCellByColumn(i,"artist"));
			albumBoxArray[i].setTitle(albums.getRowCellByColumn(i,"album"));
			albumBoxArray[i].insertAlbum(viewBox);
		}
	}
	
	function AlbumBox()
	{
		var imageSrc;
		var title;
		var genre;
		var artist;
		var framebox;
		var image;
		var listbox;
		var parentVbox;
		
		function setArtist(artist)
		{
			this.artist = artist;
		}
		
		function setTitle(title)
		{
			this.title = title;
		}
		
		function setGenre(genre)
		{
			this.artist = genre;
		}
		
		function setImageSrc(imageSrc)
		{
			this.imageSrc = imageSrc;
		}
		
		function insertAlbum(parentVbox)
		{
			this.parentVbox = parentVbox;
			if (framebox = null)
			{
				framebox = document.createElement("hbox");
				framebox.setAttribute("flex","1");
				framebox.setAttribute("align","top");
				framebox.setAttribute("onclick","setAlbumFilter(" + title + ");"); 
				
				image = document.createElement("image");
				image.setAttribute("src",imageSrc);
				framebox.appendChild(image);
				
				listbox = document.createElement("listbox");
				listbox.appendItem("Title: " + title);
				listbox.appendItem("Artist: " + artist);
				listbox.appendItem("Genre: " + genre);
				framebox.appendChild(listbox);
			}
			framebox.appendChild(image);
			framebox.appendChild(listbox);
			parentVbox.appendChild(framebox);
		}
		
		function removeAlbum(parentVbox)
		{
			try{
			parentVbox.removeChild(framebox);
			}
			catch (e){}
		}
	}
	
	function setAlbumFilter( aAlbum ) {
		try {
		  // Crack out the variables we'll need
		  var playlist = document.getElementById( "playlist_test" );
		  var mediaListView = playlist.mediaListView;
		  var cascadeFilterSet = mediaListView.cascadeFilterSet;
		  // Find which filter index is the album filter
		  var albumIndex = -1;
		  for ( albumIndex = 0; albumIndex < cascadeFilterSet.length; albumIndex++ ) {
			if ( cascadeFilterSet.getProperty( albumIndex ) == SBProperties.albumName )
			  break;
		  }
		  // If we found the albumIndex
		  if ( albumIndex < cascadeFilterSet.length ) {
			// Get all the valid albums
			var albums = cascadeFilterSet.getValues( albumIndex );
			// Find the requested album
			while ( albums.hasMore() ) {
			  var album = albums.getNext();
			  if ( album == aAlbum ) {
				// And set a single filter value and return
				cascadeFilterSet.set( albumIndex, [ aAlbum ], 1 );
				return;
			  }
			}
			// OTHERWISE, I guess you meant to clear the filter, right?
			cascadeFilterSet.set( albumIndex, [ ], 0 );
		  }
		} catch ( err ) {
		  alert( "setAlbumFilter( '" + aAlbum + "' )\n\n" + err );
		}
	}
}
catch(err) {}
			
		


